/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package seGobangClient.configMenu;

import java.util.HashMap;
import seGobangClient.GlobalController;
import seGobangClient.ICommand;
import seGobangClient.IUISystem;
/**
 *
 * @author yk
 */
public class ConfigController implements seGobangClient.ISceneController{
     private static HashMap <String,ICommand> CommandsPool;
    private static IConfigScene Scene;  
    public ConfigController(IUISystem Scene)
    {
       this.Scene=(IConfigScene) Scene;
        Scene.setCurrentController(this);
        Scene.currentSceneChangeTo("ConfigManu");
        if (CommandsPool==null) blendCommands();
       this.Scene.Options_perform(GlobalController.getCurrentOptions());
       this.Scene.Rule_perform(GlobalController.getCurrentRule());
    }
    public Object doEvent(String CommandName, Object Param) {
      try{
            CommandsPool.get(CommandName).execute(Param);
        }catch(Exception e){
            e.printStackTrace();
        }
        return null;
    }

    public void blendCommands() {
        CommandsPool=new HashMap <String,ICommand>();
        CommandsPool.put("ExitGame", new seGobangClient.mainMenu.CommandExitGame());
        CommandsPool.put("CancelOption", new CommandCancelOption());
        CommandsPool.put("CommitOption",new CommandCommitOption());
    }

}
